var fs = require("fs");

var request = require("request");
// var uri = "helloworld";
var j = request.jar();
// j.setCookie("yay=loader", uri);
//登陆
request({
    "url" : "https://forums.e-hentai.org/index.php?act=Login&CODE=01&b=&bt=&UserName=waprong&PassWord=19890226&CookieDate=1",
    // "url" : "http://forums.e-hentai.org/index.php?s=6eb25780ecf8b7261c43f7e8289f522b&amp;act=Login&amp;CODE=01&amp;CookieDate=1&UserName=waprong&PassWord=19890226",
    "jar" : j
}, function(error, response, body){
    if(error){
      throw error;
    }else{
      console.log(response.statusCode + ":" + response.toJSON().headers['set-cookie'][0]);
      if(response.statusCode == 200){
        // console.log(response.toJSON());
        fs.writeFile("d:/login.txt", body, function(error){
          console.log("write to the login.txt");
        });
        //ipb_session_id=19b42c662b85818bb35f92f14e200585; path=/; domain=.e-hentai.org
      }
    }
});
